package com.pt25.study.example.domain.sharding.service.impl;

import com.pt25.base.dep.redis.RedisService;
import com.pt25.study.example.domain.sharding.ddo.ShardingS;
import com.pt25.study.example.domain.sharding.factory.ShardingFactory;
import com.pt25.study.example.domain.sharding.service.ShardingSService;
import com.pt25.study.example.repository.sharding.persistence.ShardingSRepo;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class ShardingSServiceImpl implements ShardingSService {

    @Resource
    private ShardingFactory shardingFactory;

    @Resource
    private ShardingSRepo shardingSRepo;

    @Override
    public ShardingS getShardingS(Long id) {
        return shardingSRepo.getShardingS(id);
    }

    @Override
    public void addShardingS(ShardingS shardingS) {
        shardingSRepo.save(shardingFactory.ShardingS2ShardingSPo(shardingS));
    }
}
